import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class Main {
    public static void main(String[] args) {
        Map<String, Integer> map = new TreeMap<>();
        map.put("ok", 15);
        map.put("am", 7);
        map.put("is", 3);
        map.put("because", 1);
        map.put("word", 6);
        int value = map.get("word");
        System.out.println(value);
        int value2 = map.getOrDefault("world", -1);
        System.out.println(value2);
        map.remove("because");
        System.out.println();

        Set<String> set = map.keySet();
        for (String s:set) {
            System.out.print(s + " ");
        }
        Collection<Integer> collection = map.values();
        System.out.println();

        Set<Map.Entry<String, Integer>> entries = map.entrySet();
        for (Map.Entry<String, Integer> entry:entries) {
            System.out.println("Key:" + entry.getKey() + " Value:" + entry.getValue());
        }
    }
    public static void main1(String[] args) {
        BinarySearchTree binarySearchTree = new BinarySearchTree();

        binarySearchTree.insert(6);
        binarySearchTree.insert(3);
        binarySearchTree.insert(8);
        binarySearchTree.insert(4);
        System.out.println(binarySearchTree.search(15));
        binarySearchTree.remove(8);
        System.out.println();
    }
}